package com.kermel.andromeda.activities.alarm.add;

import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.widget.TimePicker;

import com.kermel.andromeda.common.action.DialogPromptAction;
import com.kermel.andromeda.data.AlarmTimeModel;

public class ChooseAlarmTimeAction extends DialogPromptAction implements TimePickerDialog.OnTimeSetListener {
    public static final int MINUTES_PER_HOUR = 60;
    public AlarmTimeModel model;
    
    public ChooseAlarmTimeAction(Context context, AlarmTimeModel model) {
        super(context);
        this.model = model;
    }
    
    protected Dialog createDialog() {
        TimePickerDialog timePickerDialog = new TimePickerDialog(context, this, model.hour, model.minute, model.militaryTime);
        return timePickerDialog;
    }
    
    public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
        model.hour = hourOfDay;
        model.minute = minute;
        closeDialog();
    }
}
